<ol class="breadcrumb">
  <li><a href="<%= path_for %>"><%= @model.display_name %></a></li>
  <% if @resource.new_record? %>
  <li class="active"><%= t :new %></li>
  <% else %>
  <li><a href="<%= path_for @resource.id %>"><%= @resource.display_name %></a></li>
  <li class="active"><%= t :edit %></li>
  <% end %>
</ol>
<form class="form-horizontal" action="<%= @resource.new_record? ? path_for : path_for(@resource.id) %>" method="post">
<% if @resource.errors.any? %>
  <div class="alert alert-danger">
    <p><%= @resource.errors.count %> <%= "error".pluralize(@resource.errors.count) %> prohibited this resource from being saved:</p>
    <ul>
    <% @resource.errors.each do |k, message| %>
      <li><%= t @model.fields[k.to_s] %> <%= message %></li>
    <% end %>
    </ul>
  </div>
<% end %>
<% @model.fields.each do |name, field| %>
  <%= present @resource, field, target: :editor if @resource.writable? current_user, field %>
<% end %>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary"><%= t :submit %></button>
    </div>
  </div>
</form>
